package puf2

import chisel3._
import chisel3.util._
import chisel3.experimental._

import puf2.PUF_Constants._

class PUF_Top_Output_Ports extends Bundle {
    val Data_in     =   Output(UInt(1.W))
    val Ena_in      =   Output(Bool())
    val Clk_in      =   Output(Bool())

    val Data_out    =   Input(UInt(1.W))
    val Ena_out     =   Output(Bool())
    val Clk_out     =   Output(Bool())
    
    val Clk         =   Output(Bool())
    val WL_Enable   =   Output(Bool())
    val Write_Ena   =   Output(Bool())
}

class PUF_Core_Output_Ports extends Bundle {
    val Data_in     =   Output(UInt(1.W))
    val Ena_in      =   Output(Bool())
    val Clk_in      =   Output(Bool())

    // val Data_out    =   Input(UInt(1.W))
    val Ena_out     =   Output(Bool())
    val Clk_out     =   Output(Bool())
}


class PUF_Control_Ports extends Bundle{
    val puf_in_valid    =   Input(Bool())
    val puf_in_ready    =   Output(Bool())
    val puf_data_in     =   Input(UInt(WIDTH_DATA.W))  // !!! attention , to be replaced by the CONSTANT
    
    val puf_out_valid   =   Output(Bool())
    val puf_out_ready   =   Input(Bool())
    val puf_data_out    =   Output(UInt(TRANS_CNT.W))   // !!! attention , to be replaced by the CONSTANT

    val puf_wl_ena      =   Input(Bool())
    val puf_write_ena   =   Input(Bool())
}

class PUF_Control_Core_Ports extends Bundle{
    val puf_in_valid    =   Input(Bool())
    val puf_in_ready    =   Output(Bool())
    val puf_data_in     =   Input(UInt(WIDTH_DATA.W))  // !!! attention , to be replaced by the CONSTANT
    
    val puf_out_valid   =   Output(Bool())
    val puf_out_ready   =   Input(Bool())
    // val puf_data_out    =   Output(UInt(TRANS_CNT.W))   // !!! attention , to be replaced by the CONSTANT

    val puf_wl_ena      =   Input(Bool())
    val puf_write_ena   =   Input(Bool())
}

class PUF_Core_Input_clk extends Bundle {
    val Clk             =   Input(Clock())
    // val Clk_reverse     =   Input(Clock())
}

class PUF_LED_Ports extends Bundle{
    val led         =   Output(UInt(8.W))
}